<%@ page language="java" pageEncoding="GB18030"%>
<%@ page import="personal.study.form.LoginForm" %>
<%@ page import="personal.study.form.UserTaskForm" %>
<%@ page import="java.util.Collection" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.util.ArrayList" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%
	LoginForm loginForm = (LoginForm)session.getAttribute("SysUser");
	if(loginForm == null){
		loginForm = new LoginForm();		
	}
	Collection col = loginForm.getCol();
%>
<%!
	private boolean isContained(String task,Collection col){
		boolean result = false;
		UserTaskForm userTaskForm = null;
		for(Iterator it=col.iterator();it.hasNext();){
			userTaskForm=(UserTaskForm)it.next();
			if(task.equals(userTaskForm.getTaskCode())){
				result = true;
				break;
			}
		}
		return result;
	}
%>
<html>
	<head>
		<title>Menu</title>
		<base target="main">
	</head>
	
	<script type="text/javascript">
		function relogin(){
			parent.frameMain.rows="0,*";
			parent.frameDown.cols="0,*";
		}
	</script>

	<body>
		<%if(isContained("userMag", col)){ %>
		<a href="<%=request.getContextPath() %>/user/UserList.jsp">user management</a>
		<br><br>
		<%} if(isContained("suppMag", col)){ %>
		<a href="<%=request.getContextPath() %>/supplier.do?method=query">Supplier management</a>
		<br><br>
		<%} if(isContained("mateMag", col)){ %>
		<a href="<%=request.getContextPath() %>/material/MaterialList.jsp">materials management</a>
		<br><br>
		<%} if(isContained("make", col)){ %>
		<a href="<%=request.getContextPath() %>/storage.do?method=query">product management</a>
		<br><br>
		<%} if(isContained("tranMag", col)){ %>
		<a href="<%=request.getContextPath() %>/transaction.do?method=queryResult&transStatus=0">delivery management</a>
		<%} %>
		<br><br><br><br><br><br>
		<a href="<%=request.getContextPath() %>/purchase.do?method=purchase">client purchase</a>
		<br><br>
		<a href="login.jsp" onclick="relogin()">log in again</a>
	</body>
</html>
